<?php

namespace App\Admin\Actions\CollectionAction;

use App\Models\Collection;
use Illuminate\Http\Request;
use App\Services\BatchCreateImage\BatchCreateImage;
use Encore\Admin\Actions\RowAction;

class BatchImgCreate extends RowAction
{
	public $name = '批量合成';

	public function handle()
    {
	   $collection = Collection::find($this->getKey());
	   
	    app(BatchCreateImage::class, [
	    	'collection' => $collection
	    ])->make();
	    
	    return $this->response()->success('合成计划已提交，请耐心等待')->refresh();
    }
	
	public function dialog()
	{
		$this->confirm('确定合成所有图吗？');
	}
}
